/*
 *
 * Copyright (c) 2007, LilyStudio Nanjing University.
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *  * Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 *  * Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *  * Neither the name of LilyStudio Nanjing University nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
package org.lilystudio.veryftp.model;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

//import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.Analyzer;
import org.hibernate.search.annotations.ContainedIn;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Index;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded;
import org.hibernate.search.annotations.Store;

/**
 * FTPFile generated by MyEclipse Persistence Tools and Modified by Goodtiger
 * 
 * @author Goodtiger
 * @version Oct 25, 2007
 */
@Indexed(index="ParentFiles")
@Analyzer(impl=org.lilystudio.veryftp.analyzer.VeryAnalyzer.class)
public class ParentFile implements java.io.Serializable{
	
	private static final long serialVersionUID = 853746989839701187L;	
	
	@DocumentId(name="fileId")	
	private long fileId;
	
	@Field(index=Index.NO, store=Store.YES)
	private String fileName;

	@Field(index=Index.NO, store=Store.YES)
	private String fileUrl;
	
	@Field(index=Index.NO, store=Store.YES)
	private Date fileModifyTime;
	
	private boolean fileAvailable;
	
	private int fileState;
	
	@IndexedEmbedded(depth=1,prefix="Site_")
	private FTPSite downSite;
	
	@ContainedIn
	private Set<FTPFile> childFiles = new HashSet<FTPFile>();
	
	public ParentFile() {
	}

	public ParentFile(ParentFile file){
		this.fileId=file.fileId;
		this.fileAvailable=file.fileAvailable;
		this.fileModifyTime=file.fileModifyTime;
		this.fileName=file.fileName;
		this.fileUrl=file.fileUrl;
	}

	/**
	 * @return the fileName
	 */
	public String getFileName() {
		return fileName;
	}

	/**
	 * @param fileName
	 *            the fileName to set
	 */
	public void setFileName(String fileName) {
		this.fileName = fileName;
	}

	/**
	 * @return the fileUrl
	 */
	public String getFileUrl() {
		return fileUrl;
	}

	/**
	 * @param fileUrl
	 *            the fileUrl to set
	 */
	public void setFileUrl(String fileUrl) {
		this.fileUrl = fileUrl;
	}


	/**
	 * @return the fileModifyTime
	 */
	public Date getFileModifyTime() {
		return fileModifyTime;
	}

	/**
	 * @param fileModifyTime
	 *            the fileModifyTime to set
	 */
	public void setFileModifyTime(Date fileModifyTime) {
		this.fileModifyTime = fileModifyTime;
	}

	/**
	 * @return the fileAvailable
	 */
	public boolean isFileAvailable() {
		return fileAvailable;
	}

	/**
	 * @param fileAvailable
	 *            the fileAvailable to set
	 */
	public void setFileAvailable(boolean fileAvailable) {
		this.fileAvailable = fileAvailable;
	}

	/**
	 * @return the fileState
	 */
	public int getFileState() {
		return fileState;
	}

	/**
	 * @param fileState
	 *            the fileState to set
	 */
	public void setFileState(int fileState) {
		this.fileState = fileState;
	}

	/**
	 * @return the childFiles
	 */
	public Set<FTPFile> getChildFiles() {
		return childFiles;
	}

	/**
	 * @param childFiles
	 *            the childFiles to set
	 */
	public void setChildFiles(Set<FTPFile> childFiles) {
		this.childFiles = childFiles;
	}

	/**
	 * @return the fileId
	 */
	public long getFileId() {
		return fileId;
	}

	/**
	 * @param fileId
	 *            the fileId to set
	 */
	public void setFileId(long fileId) {
		this.fileId = fileId;
	}

	public FTPSite getDownSite() {
		return downSite;
	}

	public void setDownSite(FTPSite downSite) {
		this.downSite = downSite;
	}

}